home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / WINSYS.PAK / LCLSTRNG.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  74 lines

  1. //----------------------------------------------------------------------------
  2. // Borland WinSys Library
  3. // Copyright (c) 1994, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   5.7  $
  6. //
  7. // TLocaleString - localized name support
  8. //----------------------------------------------------------------------------
  9. #if !defined(WINSYS_LCLSTRNG_H)
  10. #define WINSYS_LCLSTRNG_H
  11.  
  12. #if !defined(WINSYS_DEFS_H)
  13. # include <winsys/defs.h>
  14. #endif
  15. #if !defined(BI_PLAT_MSW)
  16. # error Locale classes are only supported under MSW
  17. #endif
  18. #if !defined(SERVICES_CSTRING_H)
  19. # include <services/cstring.h>
  20. #endif
  21.  
  22. #if defined(BI_NAMESPACE)
  23. namespace ClassLib {
  24. #endif
  25.  
  26. #define DEFAULT_SYSTEM_LANGID 0x409   // in case 16-bit with no NLS support
  27. typedef uint16 TLangId;               // language ID - same as NT LANGID
  28. typedef int (*TstricmpLang)(const _TCHAR far*, const _TCHAR far*, TLangId);
  29. const TLangId LangSysDefault  = 0x0800;
  30. const TLangId LangUserDefault = 0x0400;
  31. const TLangId LangNeutral     = 0x0000;
  32.  
  33. //----------------------------------------------------------------------------
  34. // TLocaleString - localizable substitute for char*
  35. //
  36.  
  37. struct TLocaleString {
  38.   const _TCHAR* Translate(TLangId lang);                      // translate string
  39.   operator const _TCHAR*();      // return current string
  40.   void operator =(const _TCHAR* str) { Private = str; }
  41.   int   Compare(const _TCHAR far* str, TLangId lang);   // insensitive compare
  42.  
  43.   const _TCHAR* Private;         // string pointer used for initialization
  44.  
  45.   static TLangId GetSystemLangId();  // platform-dependent implementation
  46.   static TLangId GetUserLangId();    // platform-dependent implementation
  47.   static int     IsNativeLangId(TLangId lang);  // returns bool true if native
  48.   static TLangId SystemDefaultLangId;// must define and set to system language
  49.   static TLangId UserDefaultLangId;  // same as system language if single user
  50.   static TLangId NativeLangId;   // must define and set to lang. of literals
  51.   static HINSTANCE Module;       // must define and set to resource module
  52.   static TLocaleString Null;     // reference a null string
  53.   static int CompareLang(const _TCHAR far* s1, const _TCHAR far* s2, TLangId);
  54.           // CompareLang() may be implemented in another module for NLS support
  55. };
  56.  
  57. #if defined(BI_NAMESPACE)
  58. }     // namespace ClassLib
  59. #endif
  60.  
  61. //
  62. // Prefix characters for locale strings
  63. //
  64. #define AUTOLANG_RCID  '#' // indicates name specified by numeric ID
  65. #define AUTOLANG_XLAT  '!' // indicates name to be localized (binary)
  66. #define AUTOLANG_LOAD  '@' // indicates resource name to load (binary)
  67.  
  68. //
  69. // Custom resource for translations
  70. //
  71. #define RT_LOCALIZATION MAKEINTRESOURCE(201)
  72.  
  73. #endif  // WINSYS_LCLSTRNG_H
  74.